module.exports = app => {
    const mongoose = app.mongoose;
    const Schema = mongoose.Schema;
    //教育经历
    const eduSchema = new Schema({
        startDate: Date,//至月份
        endDate: Date,
        school:String,
        major:String,//专业
        degree:String,//学历
        isFullTime:String,//1 全日制 0 非全日制
    });
    //工作经历
    const workSchema = new Schema({
        startDate: Date,//至月份
        endDate: Date,
        company:Date,
        position:String,
        colleagueName:String,//上级或者同事姓名
        colleagueTel:String,//上级或者同事电话
        salary:String,
        leaveReason:String
    });
    //家庭关系
    const familySchema = new Schema({
        relationship:String,
        name:String,
        age:String,
        workUnit:String,// 工作单位
        tel:String
    });
    //培训经历
    const trainingSchema = new Schema({
        skillTitle:String,//头衔
        grantingTime:Date,//授予时间
        level:String,//技能等级
        certificateCode:String//证书编码
    });
    const evaluationSchema = new Schema({
          name:String,//评价人姓名
          title:String,//评价人头衔
          content:String,//评价人意见
          agree:{//同意/合适
              type: Number,
              default: 0
          }, //0 不同意 1同意
          date:Date,
    });
    const IterviewformSchema = new Schema({
      //  IterviewformId:String,
        name: String, // 姓名
        sex: {
            type: Number,
            default: 1
        }, // 性别 1男 2女
        birthTime:Date,
        birthPlace:String,
        // role: { type: Schema.Types.ObjectId, ref: 'Role',default: 'visitor' },
        tel: String,
        mail:String,
        idCard:String,
        workYear:String,
        currentPlace:String,
        familyTel:String,
        currentSalary:Number,
        expectedSalary:Number,
        position:String,
        //
        eduExperience: [eduSchema],
        workExperience: [workSchema],
        trainingExperience: [trainingSchema],
        familys: [familySchema],
        evaluations:[evaluationSchema],//

        createDate: Date, // 创建时间
        updateDate: Date // 修改时间
    });
    return mongoose.model('Iterviewform', IterviewformSchema);
};